import axios from "~/axios"; // 获取的是src目录下的axios.js

export function getCouponList(page) {
  return axios.get(`/admin/coupon/${page}`);
}

export function createCoupon(data) {
  return axios.post(`/admin/coupon`, data);
}

export function updateCoupon(id, data) {
  return axios.post(`/admin/coupon/${id}`, data);
}

export function deleteCoupon(id) {
  return axios.post(`/admin/coupon/${id}/delete`);
}

// 让优惠券失效
export function updateCouponStatus(id) {
  return axios.post(`/admin/coupon/${id}/update_status`, {
    status: 0, // 0是失效 所以这里写死
  });
}
